# Maintainer: Martell Malone <martell malone at g mail dot com>

_realname=winpty
pkgname="${_realname}-git"
_ver_base=1.1.1
pkgver=1.1.1.218.3b73576
pkgrel=1
pkgdesc="A Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs"
arch=('i686' 'x86_64')
url="https://github.com/rprichard/winpty"
license=("MIT")
makedepends=("git" "gcc" "autoconf" "gperf" "bison" "flex" "wget" "tar" "patch" "make" "libtool" "automake" "xz"
             "mingw-w64-cross-gcc")
provides=("${_realname}")
conflicts=("${_realname}")
#depends=( "ncurses-devel" )
options=('staticlibs' 'strip')

source=("${_realname}"::"git+https://github.com/rprichard/winpty.git"
        "0002-Add-support-for-conversion-of-all-argv-path-args.patch"
        "0003-rename-console.exe-to-winpty.exe-for-mintty-unicode-.patch")

md5sums=('SKIP'
         'e352e89e98422fcdbc0182b99a22dccf'
         'e008b13c3647a87aefab346ba3d8da2f')


pkgver() {
  cd "${srcdir}/${_realname}"
  printf "%s.%s.%s" "${_ver_base}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/${_realname}"

  git am "$srcdir/0002-Add-support-for-conversion-of-all-argv-path-args.patch"
  git am "$srcdir/0003-rename-console.exe-to-winpty.exe-for-mintty-unicode-.patch"
}

build() {
  cd "${srcdir}/${_realname}"
  ./configure --build=${CHOST} \
    --prefix=/usr
  make
}

package() {
  cd "${srcdir}/${_realname}"
  make PREFIX=${pkgdir}/usr install
}
